package com.foreknow.util;

import javax.swing.*;
import javax.swing.table.DefaultTableModel;

public class PropertyJTable {

    private static PropertyJTable jTable = null;

    private DefaultTableModel model = new DefaultTableModel();

    private PropertyJTable(){

    }

    public static PropertyJTable getjTable() {
        if(jTable == null) {
            jTable = new PropertyJTable();
        }
        return jTable;
    }

    /**
     * 根据data和column创建一个表格
     * @param data
     * @param column
     * @return
     */
    public JTable createJtable(Object[][] data, String[] column) {
        model.setDataVector(data,column);
        JTable jTable = new JTable(model);
        return jTable;
    }

    /**
     * 更新表格
     * @param data
     * @param column
     */
    public void update(Object[][] data, String[] column){
        model.setDataVector(data,column);
    }





}
